package com.my.chapter11;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class practice9 {
    public static void main(String[] args) {
        Sequence9.main(args);
    }
}

class Sequence9{
    private List<Object> items;
    public Sequence9(){
        items = new ArrayList<Object>();
    }
    public void add(Object x){
        items.add(x);
    }
    public void display(){
        Iterator<Object> it = items.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }
    }

    public static void main(String[] args) {
        Sequence9 sequence = new Sequence9();

        for(int i=0;i<10;i++){
            sequence.add(new Integer(i));
        }
        sequence.display();
    }
}

